<tagLib name="html" />
{$header}<div id="main" class="main" >
<!-- 主体内容  -->
<div class="content" >
  
  <php>
    $str = __SELF__;
    $pattern = "/\&keywords(.*)+/";
    $post_url = preg_replace($pattern, "\$1", $str);
  </php>  
<!--  功能组区域  -->
<div class="btn-toolbar">
  <button class="btn"> 选择产品</button>
          <form class="search-form pull-right" method='post' action="{$post_url}">
            {:modList('Category',$_REQUEST['cat_id'],'span2','cat_id')}
              <input type="text" class="search-query span4" name="keywords" <notempty name='_REQUEST.keywords'>
                    <php>echo 'value="'.urldecode($_REQUEST['keywords']).'"'</php><else/>
                    placeholder="搜索"
                </notempty>
                >
                <input type="submit" class="btn btn-primary" value="搜索">
          </form>
  </div>
<!-- 功能组区域结束 -->
<php>
    function getCateName($cat_id=0){
        return getModelName($cat_id,'Category');
    }
    function getUnitName($cat_id=0){
        return getModelName($cat_id,'Unit');
    }
</php>
<!-- 列表显示区域  -->
<div class="list" >
<div id="result" class="result none"></div>
<table class="table table-bordered table-striped" id="checkList">
<tr>
  <th width="5%"><a href="javascript:sortBy('id','1','search',".urldecode($_REQUEST['keywords'])."'" title="按照编号升序排列 ">编号</a>
  </th>
  <th>
    <a href="javascript:sortBy('name','1','search',".urldecode($_REQUEST['keywords'].")" title="按照名称升序排列 ">名称</a>
  </th>
  <th>
    <a href="javascript:sortBy('ename','1','search','')" title="按照助记词升序排列 ">英文名</a>
  </th>
  <th>
    <a href="javascript:sortBy('cas','1','search','')" title="按照条形码升序排列 ">CAS</a>
  </th>
  <th>
    <a href="javascript:sortBy('formula','1','search','')" title="按照类别升序排列 ">分子式</a>
  </th>
  <th>
    <a href="javascript:sortBy('weight','1','search','')" title="按照单位升序排列 ">分子量</a>
  </th>
  <th>
    <a href="javascript:sortBy('nature','1','search','')" title="按照默认进价升序排列 ">性质</a>
  </th>
  <th>
    <a href="javascript:sortBy('cat_id','1','search','')" title="按照默认进价升序排列 ">类别</a>
  </th>
  <th width="8">
    选择</th>
</tr>
<volist name="list" id="vo">
  <tr>
    <td>{$vo.id}</td>
    <td><a href="javascript:edit('3754')">{$vo.name}</a></td>
    <td>{$vo.ename}</td>
    <td>{$vo.cas}</td>
    <td>{$vo.formula}</td>
    <td>{$vo.weight}</td>
    <td>{$vo.nature}</td>
    <td>{$vo.cat_id|getCateName}</td>
    <td><input type="checkbox" value='{$vo.id}' onclick="selectpro(this.value,'{$vo.name|addslashes}({$vo.ename|addslashes}) {$vo.cas}')"></td>
  </tr>
</volist>
</table>
<!--  分页显示区域 -->
<div class="page">{$page}</div>
<!-- 列表显示区域结束 -->
</div>
<!-- 主体内容结束 -->
</div>

<!-- 主页面结束 -->
<include file="Public:footer"/>
<script type="text/javascript" src="__PUBLIC__/Js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" language="javascript">
  function selectpro(id,name){
    name = unescape(name);
      <notempty name='_REQUEST.supplier_id'>
      opener.document.location.href=APP+"/Supplier_product/insert2/product_id/"+id+"/supplier_id/"+{$_REQUEST.supplier_id};
          <else/>
          <eq name='_REQUEST.t' value='hz'>
        window.opener.document.form1.hz_id.value = id;
        <else/>
        window.opener.document.form1.product_id.value = id;
      </eq>
        window.opener.document.form1.q.value = name;
      </notempty>

      window.close(); 
      return false;
}
 

</script>
